import { View, Text, BaseEventOrig, FormProps } from "@tarojs/components";
import { useEffect, useRef, useState } from "react"; // 使用 useEffect 替代可能错误的 useLoad
import api  from '../../apis/user'
import "./index.scss";
import {
  Button,
  Calendar,
  Cell,
  Checkbox,
  Field,
  Form,
  Input,
  Radio,
  Stepper,
  Steps,
  Toast,
} from "@taroify/core";
import { FormItemInstance } from "@taroify/core/form";
import _ from "lodash";

export default function Index() {
  const postData = {
    name: "admin",
    age: "123"
  };

  const getData = async () => {
    const res = await api.getUserInfo(JSON.stringify(postData));
    console.log(res);
  };
  const login = async () => {
    const res = await api.userLogin(JSON.stringify(postData));
    console.log(res);
  };
  return (
    <View>
      <Button shape="round" block color="primary" onClick={getData}>
        获取用户信息
      </Button>
      <Button shape="round" block color="primary" onClick={login}>
        登录
      </Button>
    </View>
  );
}
